<?php

namespace Drupal\commerce_weight_shipping\Entity;

use Entity;

class CommerceWeightShippingItem extends Entity {

  public $id;

  public $vid;

  public $uid;

  public $op_uid;

  public $created;

  public $changed;

  public $is_new_revision;

  public $cwsid;

  public $weight = 0;

  public $note = '';

  public $national;

  public $first;

  public $first_cost;

  public $renewal;

  public $renewal_cost;

  public $status = 1;

  public $first_number = 1;

  public $renewal_number = 1;

  public $is_number = 0;

  function __construct($values = []) {
    $this->is_new_revision = TRUE;
    parent::__construct($values, 'commerce_weight_shipping_item');
  }

  public function save() {
    $this->changed = REQUEST_TIME;
    if (empty($this->created)) {
      $this->created = REQUEST_TIME;
    }

    $this->op_uid = $GLOBALS['user']->uid;
    if (empty($this->uid)) {
      $this->uid = $GLOBALS['user']->uid;
    }
    $this->status = 1;
    return parent::save();
  }

}
